package com.danbay.framework.db.datasource;

/**
 * 每个数据源名称
 *
 * @author SJG
 */
public enum DataSourceEnum {
    ONE(1), TWO(2), THREE(3), FOUR(4), FIVE(5), SIX(6), SEVEN(7), EIGHT(8), NINE(9), TEN(10);
    private int value;

    DataSourceEnum(int value) {
        this.value = value;
    }

    public int getValue() {
        return value;
    }

    /**
     * 从value转换为对应的枚举
     * @param value 值
     * @return 枚举
     */
    public static DataSourceEnum fromValue(int value) {
        DataSourceEnum[] all = DataSourceEnum.values();
        for (DataSourceEnum dbTypeEnum : all) {
            if(dbTypeEnum.getValue()==value){
                return dbTypeEnum;
            }
        }
        return ONE;
    }
}
